home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl151e.zip / STDLIB.H < prev    next >
C/C++ Source or Header  |  1997-03-10  |  6KB  |  180 lines

  1. #ifndef __STDLIB_H
  2. #define __STDLIB_H
  3.  
  4. #ifndef NULL
  5. #define NULL 0
  6. #endif
  7.  
  8.  
  9. #ifndef _PTRDIFF_T
  10. #define _PTRDIFF_T
  11. typedef long    ptrdiff_t;
  12. #endif
  13.  
  14. #ifndef _SIZE_T
  15. #define _SIZE_T
  16. typedef unsigned size_t;
  17. #endif
  18.  
  19. #define offsetof( s_name, m_name )  (size_t)&(((s_name _FAR *)0)->m_name)
  20.  
  21. #ifndef _WCHAR_T
  22. #define _WCHAR_T
  23. typedef unsigned wchar_t;
  24. #endif
  25.  
  26. #ifndef _DIV_T
  27. #define _DIV_T
  28. typedef struct {
  29.         int     quot;
  30.         int     rem;
  31. } div_t;
  32. #endif
  33.  
  34. #ifndef _LDIV_T
  35. #define _LDIV_T
  36. typedef struct {
  37.         long    quot;
  38.         long    rem;
  39. } ldiv_t;
  40. #endif
  41.  
  42. #define MB_CUR_MAX 18
  43.  
  44. /* Maximum value returned by "rand" function
  45. */
  46. #define RAND_MAX 0x7FFFU
  47.  
  48. #define EXIT_SUCCESS 0
  49. #define EXIT_FAILURE 1
  50.  
  51. typedef void (* atexit_t)(void);
  52.  
  53.  
  54. void         abort(void);
  55.  
  56. #if !defined(__ABS_DEFINED)
  57. #define __ABS_DEFINED
  58.  
  59. int          __abs__(int);
  60. int         abs(int __x);
  61. #  define abs(x)   __abs__(x)
  62.  
  63. #endif /* __ABS_DEFINED */
  64.  
  65. int         atexit(void (*__func)(void));
  66. double      atof(const char *__s);
  67. int         atoi(const char *__s);
  68. long        atol(const char *__s);
  69. void * bsearch(const void *__key, const void *__base,
  70.                            size_t __nelem, size_t __width,
  71.                            int (*fcmp)(const void *,
  72.                            const void *));
  73. void * calloc(size_t __nitems, size_t __size);
  74. div_t       div(int __numer, int __denom);
  75. ldiv_t      ldiv(long __numer, long __denom);
  76. void        exit(int __status);
  77. void        free(void *__block);
  78. char * getenv(const char *__name);
  79. void * malloc(size_t __size);
  80. int          mblen(const char *__s, size_t __n);
  81. size_t       mbstowcs(wchar_t *__pwcs, const char *__s,
  82.                                     size_t __n);
  83. int          mbtowc(wchar_t *__pwc, const char *__s, size_t __n);
  84. void         qsort(void *__base, size_t __nelem, size_t __width,
  85.                        int (* __fcmp)(const void *, const void *));
  86. int         rand(void);
  87. void  *realloc(void *__block, size_t __size);
  88. void        srand(unsigned __seed);
  89. char *      strdup(const char *string);
  90. double      strtod(const char *__s, char **__endptr);
  91. long          strtol(const char *__s, char **__endptr,
  92.                                     int __radix);
  93. double _strtold(const char *__s, char **__endptr);
  94. unsigned long   strtoul(const char *__s, char **__endptr,
  95.                                        int __radix);
  96. int           system(const char *__command);
  97. size_t       wcstombs(char *__s, const wchar_t *__pwcs,
  98.                                     size_t __n);
  99. int          wctomb(char *__s, wchar_t __wc);
  100. int          wctombflush(char *__s);
  101.  
  102. extern  char          ** _environ;
  103. extern  int              _fmode;
  104. extern  unsigned char    _osmajor;
  105. extern  unsigned char    _osminor;
  106. extern  unsigned int     _version;
  107.  
  108.  
  109. #define atoi(s)     ((int) atol(s))
  110.  
  111. /* Constants for MSC pathname functions */
  112.  
  113. #define _MAX_PATH       80
  114. #define _MAX_DRIVE      3
  115. #define _MAX_DIR        66
  116. #define _MAX_FNAME      9
  117. #define _MAX_EXT        5
  118.  
  119. double     _atold(const char *__s);
  120. unsigned char   _crotl(unsigned char __value, int __count);
  121. unsigned char   _crotr(unsigned char __value, int __count);
  122. char     * ecvt(double __value, int __ndig, int *__dec,
  123.                            int *__sign);
  124. void            _exit(int __status);
  125. char     * fcvt(double __value, int __ndig, int *__dec,
  126.                            int *__sign);
  127. char     *  _fullpath( char *__buf,
  128.                                  const char *__path,
  129.                                  size_t __maxlen );
  130. char     * gcvt(double __value, int __ndec, char *__buf);
  131. char     *  itoa(int __value, char *__string, int __radix);
  132. void     *  lfind(const void *__key, const void *__base,
  133.                                  size_t *__num, size_t __width,
  134.                                  int (* __fcmp)(const void *,
  135.                                  const void *));
  136.  
  137. void     *  lsearch(const void *__key, void *__base,
  138.                                  size_t *__num, size_t __width,
  139.                            int (* __fcmp)(const void *, const void *));
  140. char     *  ltoa(long __value, char *__string, int __radix);
  141. void             _makepath( char *__path,
  142.                                  const char *__drive,
  143.                                  const char *__dir,
  144.                                  const char *__name,
  145.                                  const char *__ext );
  146. int              putenv(const char *__name);
  147.  
  148. unsigned        __rotl__(unsigned __value, int __count);     /* intrinsic */
  149. unsigned        __rotr__(unsigned __value, int __count);     /* intrinsic */
  150.  
  151. void            _searchenv(const char *__file,
  152.                                  const char *__varname,
  153.                                  char *__pathname);
  154. void            _searchstr(const char *__file,
  155.                                  const char *__ipath,
  156.                                  char *__pathname);
  157. void             _splitpath( const char *__path,
  158.                                  char *__drive,
  159.                                  char *__dir,
  160.                                  char *__name,
  161.                                  char *__ext );
  162. void             swab(char *__from, char *__to, int __nbytes);
  163. char     *  ultoa(unsigned long __value, char *__string,
  164.                                  int __radix);
  165.  
  166. #define  _rotl(__value, __count)  __rotl__(__value, __count)
  167. #define  _rotr(__value, __count)  __rotr__(__value, __count)
  168.  
  169.  
  170. #define random(num)((rand()*(num))/((RAND_MAX+1))
  171.  
  172.  
  173.  
  174. #define randomize() srand((unsigned)time(NULL))
  175. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  176. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  177.  
  178. #define _itoa(__value, __string, __radix) itoa(__value, __string, __radix)
  179.  
  180. #endif  /* __STDLIB_H */